package com.strongdigit.aop.schemabased;


import org.aspectj.lang.ProceedingJoinPoint;

import javax.naming.Name;

public class BizAspect {

    public  void bizBefore(){
        System.out.println("biz before执行了");
    }

    public BizAspect() {
    }

    public void bizAfter(){

        System.out.println("biz after执行了");
    }

    public void bizAfterThrowing(){
        System.out.println("bizAfterThrowing执行了 ");
    }

    public void bizAfterFinally(){
        System.out.println("bizAfterFinally执行了");
    }

    public  Object bizAround(ProceedingJoinPoint pjp){
        Object obj= null;
        try {
            System.out.println("around 1");
            obj = pjp.proceed();
            System.out.println("around 2");

        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return obj;
    }


    //演示around通知和连接点函数直接传递参数值得用法
    public  Object bizAroundInit(ProceedingJoinPoint pjp,String name,int age){
        System.out.println("bizAroundInit:name:"+ name+";age"+age);
        Object obj= null;
        try {

            obj = pjp.proceed();


        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return obj;
    }


}
